Xbasic

FixDateString Function

Syntax

Formatted_Date as C = fixDateString(C dateString ,C dateFormat )

Arguments

Formatted_Date

A new version of the date with rearranged day, month, and year values.

dateString

A date string containing day, month, and year values.

dateFormat

A character string containing "D", "M", and "Y" separated by a delimiter.

Description

Takes a date string and a date format and transforms the date string so that it matches the format that Alpha Anywhere expects (based on the current Regional Settings configuration). The year portion MUST be the last part of the date format. I.e. Does not support formats like YYYY/mm/dd

Discussion

This function is only of use to users outside the United States who are hosting their web applications on servers in the United States, where the date format on the server does not match the date format that users of the application will be using. The function is useful in custom Xbasic pages. It takes a date string and converts it into a new date string that is based on the regional settings of the machine where Alpha Anywhere is running.

Example

For example, if the server is running on a computer that expects dates to be in M/D/Y format and the user is in the UK where the date format is D/M/Y then:

? fixDateString("31/12/04","d/m/y") 
 = "12/31/04"

See Also